<%@page import="com.kensure.shike.constant.BusiConstant"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<jsp:include page="base/header.jsp" flush="true"> 
 <jsp:param value="提现管理" name="pageTitle"/>
</jsp:include>

<!--必要样式-->
<link rel="stylesheet" href="<%=BusiConstant.context%>/common/css/style.css" type="text/css" />
<body>
<jsp:include page="base/nav.jsp" flush="true"></jsp:include>

<style>  
    .trhead td{
     	height:33px;
		vertical-align:top:middle;
		bgcolor:#f5f5f5;
		text-align: center;
    }
    .trbody td{
     	height:30px;
		vertical-align:top:middle;
		text-align: center;
    }
    
    .piaofu{
		background: #000;
		color:#ffffff;
		overflow: hidden;
		z-index: 9999;
		position: fixed;
		padding:5px;
		text-align:center;
		width: 500px;
		height: 750px;
		border-bottom-left-radius: 4px;
		border-bottom-right-radius: 4px;
		border-top-left-radius: 4px;
		border-top-right-radius: 4px;
		right: 40%;
		top: 10%;
		font-size:20px;
		
	}
	

</style>

<div id="content" style="margin-left:20px;font-size:12px;">
	<br>
                

 	<form id="chaxun">
	   	<div class="layui-form-item">
		    <div class="layui-inline">
		        <label class="layui-form-label">状态</label>
		        <div class="layui-input-inline">
			        <select id="status" style="width:auto;">
			                <option value="" >全部</option>
			                <option value="1" selected="selected">申请中</option>
			                <option value="9">已通过</option>
			        </select>
		        </div>
		     </div>  
		       
		     <input onclick="chongzhilist(1)" type="button" value="搜索"> 
	 	</div>
	</form>

   <div>
        <div>	
           <table id="headtable">
         		<thead></thead>
             	<tbody></tbody>
            </table>
        </div>
        <div id="fanye">

		</div>
		<div id="erweima" class="piaofu" style="display:none;">
			
		</div>
    </div>

</div>

</body>



<script>

function showpiaofu(id){
	var row = table.getrow(id);
	var html = "<p>姓名:"+row.user.nickname+";提现金额:"+row.jine+"; </p>	";
	var alipayImg = row.user.alipayImg;
	
	if(alipayImg){
		html += "<p style='width:500px;height:500px;overflow:hidden;'><img width='400' src='"+alipayImg+"'></p>";
	}else{
		html += "<p>未绑定付款码</p>	";
	}
	html += "<p>电话:"+row.user.phone+"；提现状态："+row.statusStr+"</p>	";
	html += "<p>提现时间："+row.createdTimeStr+"</p>";
	html += "<p><input type='button' value='通过' onclick='tongguo("+row.id+")'>&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' value='关闭' onclick='guanbi()'></p>";
	$("#erweima").html(html);
	$("#erweima").css("display","");
	
}

function guanbi(){
	$("#erweima").css("display","none");
}


var table = createtable("headtable");
var optfun = function(row){
	var tdinner = "";
   // if(row.status == 1){              	
   // 	tdinner+="<input type='button' value='通过' onclick='tongguo("+row.id+")'>";  
   // }
   // tdinner+="&nbsp;&nbsp;&nbsp;<input type='button' value='显示二维码' onclick=' showpiaofu("+row.id+")'>";  
	return tdinner;
}


var cpdata = {};
function initcp(rows){
	$.each(rows, function(i, row){  
		var id = "skWord-button"+row.id;
		if(!cpdata[id]){
			cpdata[id] = 1;
			var copyBtn = new Clipboard("#"+id);
		    copyBtn.on("success",function(e){
		        // 复制成功
		        alert(e.text);
		    });
		    copyBtn.on("error",function(e){
		        //复制失败；
		        console.log( e.action )
		    });
		}	
	})
	
}


table.th =  [{w:60,na:"提款编号",colname:"id"}
,{w:150,na:"提现时间",colname:"createdTimeStr"}
,{w:100,na:"提现金额",colname:"jine"}
,{w:80,na:"提现状态",colname:"statusStr"}
,{w:80,na:"用户编号",colname:"userid"}
,{w:80,na:"用户余额",colname:"user.yue.yue"}
,{w:100,na:"用户手机",colname:"user.phone"}
,{w:80,na:"姓名",colname:"user.nickname"}
,{w:150,na:"操作",callfun:optfun}];
table.thinit();

var fanye = new FanYe("fanye","chongzhilist",0,20,1);
	function sucdo(data){
		var rows = data.resultData.rows;
		fanye.init(data.resultData.total);	
		table.data = rows;
		table.tdinit();	
		if(rows && rows.length >0){
			//showpiaofu(rows[0].id);
		}
	}

   function chongzhilist(current){
	   if(!fanye.setpage(current)){
			return;
		}
	   var data = {typeid:2,status:$("#status option:selected").val()};
	   data.pageNo = fanye.current;
	   data.pageSize = fanye.limit;
	   var url = getbaseurl("/inout/alltixianlist.do");
	   postdo(url, data, sucdo,null, null);
   }
   
   function tongguo(id){
	   if(confirm('确认通过？')){
		   var data = {id:id};
		   var url = getbaseurl('/inout/tongguoout.do');
		   $("#erweima").css("display","none");
		   postdo(url, data, tgsucdo,null, null);
	   }
   }
   
 
   function tgsucdo(data){
	   alert("通过成功！");
	   chongzhilist(fanye.current);
   }
   
   chongzhilist(1);
   
     
</script>


</html>